package com.gitee.wsl.common.ui.ext.painter

import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.BlendMode
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.RenderVectorGroup
import androidx.compose.ui.graphics.vector.rememberVectorPainter
import androidx.compose.ui.unit.Dp


/**
 * Creates and remembers a vector painter while providing options to style it.
 *
 * This function creates a vector painter and stores it for future reference. It allows you to apply various styles
 * to the painter, such as color, stroke width, etc.
 */
@Composable
fun rememberVectorPainter(
    image: ImageVector,
    defaultWidth: Dp = image.defaultWidth,
    defaultHeight: Dp = image.defaultHeight,
    viewportWidth: Float = image.viewportWidth,
    viewportHeight: Float = image.viewportHeight,
    name: String = image.name,
    tintColor: Color = image.tintColor,
    tintBlendMode: BlendMode = image.tintBlendMode,
    autoMirror: Boolean = image.autoMirror,
) = rememberVectorPainter(
    defaultWidth = defaultWidth,
    defaultHeight = defaultHeight,
    viewportWidth = viewportWidth,
    viewportHeight = viewportHeight,
    name = name,
    tintColor = tintColor,
    tintBlendMode = tintBlendMode,
    autoMirror = autoMirror,
    content = { _, _ -> RenderVectorGroup(group = image.root) }
)